SW Finance

Retirement Calculators / Market Data Plots

by Steffen Weber, Ph.D., 2017

Copyright (c) 2017


Introduction

This program started out as a programming exercise, because my good neighbor George Tardiff wished to see how software is written. So I picked a topic that was also of some interest to me and ended up creating this software.

For me the challenge was to create some widgets, such as the ticker quote batches and the market data plot viewer. For the latter I used my experience in writing XRD powder diffraction software, which require similar graph viewers.

I wrote this program in December 2015 when Yahoo still provided a free API for retrieving the stock quotes and market data. As Yahoo discontinued its service this project was put on ice until I just recently found a new provider of free market data in AlphaVantage. That allowed me to finally upload this software for anyone who is interested.

The practical usefulness of this program may be limited to the implemented retirement calculators as more powerful market data tools are readily available at official finance websites, such as Yahoo-Finance or Google-Finance.

The calculators are interactive and help visualize the power of compound interest in the context of investing or saving. Urban legends even ascribe several quotes in this regard to Albert Einstein, who is said to have called it "the most powerful force in the universe". Understanding it will help you plan for retirement as it emphasizes the importance of time, meaning the importance of starting early when saving for retirement. In this sense Benjamin Franklin was right in saying that "time is money".

I have no background in the field of personl finance and have merely acquired a certain level of financial education by reading Ric Edelman's books and by listening to his podcasts. In contrast to TV pundits who give risky stock recommendations or who focus on debt elimination instead of wealth creation, he is a true educator, who makes us understand how money works, in the same vein as Carl Sagan explained to us how the universe works.

For anyone still timid and scared about participating in the stock/bond market I highly recommend Ric Edelman's book "The truth about money", which provides an essential education about the world of finance, in which we all are forced to participate as members of a capitalist system. It really pays off spending a few days reading this book as it can greatly improve your prospect of success in your future retirement by empowering you to make informed decisions about how to invest wisely and avoid pitfalls. Anyone who chooses to stay out of the stock fund market and keeps his/her savings in "safe" investments, such as cash or bank CDs may see that he/she is going broke "safely" as those investment vehicles may not even keep up with inflation (let alone build wealth) and the buying power of one's "safe" investments may decrease instead of increase. One should keep in mind that historically the stock market has outperformed all other investment options with an average of about 10% of annual returns. By creating diversified portfolios one can adjust the portion of stock investments to fit one's level of risk tolerance and still partake in the earning potential of stock investments. As Ric often points out, there are 17 major investment classes, so one does not have to put all one's eggs into a stock's basket.

Steffen Weber, PhD.
Nov. 2017

Useful Rule of 72

72 divided by interest rate gives you the number of years an investment takes to double in value.
(e.g. an investment yielding 7.2% in annual returns will double in value in 10 years)

72 divided by a number of years gives the required interest rate for an investment to double its value in that period.
(e.g. if an investment's value is to double in 12 years it must yield at least 6% in annual returns)

Needed Retirement Savings

Rule of thumb: desired annual retirement income times 20, corresponding to a "safe" withdrawal rate of 5% annually when assuming that investments continue to produce an annual return of ~5%.

Scott Adams (Dilbert)

Everything You Need to Know about Personal Investing

  1. Make a will.
  2. Pay off your credit card balance.
  3. Get term life insurance if you have a family to support.
  4. Fund your company 401K to the maximum.
  5. Fund your IRA to the maximum.
  6. Buy a house if you want to live in a house and can afford it.
  7. Put six months' expenses in a money-market account.
  8. Take whatever money is left over and invest 70% in a stock index fund and 30% in a bond fund through any discount brokerage company and never touch it until retirement.
  9. If any of this confuses you, or you have something special going on (retirement, college planning, tax issue), hire a fee-based financial planner, not one who charges a percentage of your portfolio.

"Everything else you might want to do with your money is a bad idea compared to what’s on my one-page summary. You want an annuity? It’s worse. You want a whole life insurance policy? It’s worse. You want to invest in individual stocks? It’s worse. You want a managed mutual fund instead of an index fund? It’s worse. I could go on, but you get the point."


Market Data

When no connection to the data provider is detected the program will start with only the calculators visible. This can also be done manually using the menu [Help][Calculators Only].

The first and start-up tab shows the market data. On the left several fixed ticker batches are shown and the drop-down selector lists the 30 biggest companies in the Dow Jones Index. One can also type in any other valid ticker symbol and either hit <Enter> or click the button [Get], in order to retrieve its market data in form of a CSV file, which is parsed and listed below the graph plot.

The retrieval of the market data takes some time as a whole CSV file needs to be downloaded each time you change the ticker symbols.

The symbol label at the top-right of the plot was supposed to show the company name in parentheses, which worked when I used Yahoo, but AlphaVantage does not yet provide the company name for a given ticker symbol.

Click the [<<] button to collapse the left-side panel.

Graph Viewer

The plot is interactive. You can zoom with a rectangle selection and pan with the MouseWheel or RightMouseButton-drag. A context menu is available upon RightClick.

The height of the full graph plot can be changed by RightClicks. In addition to grabbing the range handles one can also use the MouseWheel for changing the zoom range (plot time interval).

Switch to a simpler graph viewer using the menu [Market][Simple Plot].

Export Plot Image

Use menu [File][Copy Image], in order to copy the plot image to the clipboard.

Web Browser Page

When switching to the [Web]-tab you can see the Google-Finance page for the selected ticker symbol. I implemented this purely for convenience, so that I could check whether the retrieved market data are correct.


Portfolios

This tool lets you create portfolios and view the corresponding pie charts. This is especially useful if you combine several accounts/portfolios and want to see the overall portfolio asset allocation. When analysing investments it is much more useful to work with percentages instead of actual dollar amounts, so that one gets a better idea of the suitability of a chosen asset allocation.

Portfolios can be saved as encrypted files with the extension *.pfo. A default data folder is provided when saving a new portfolio.

Click the row header of a listed investment, in order to retrieve its market data for plotting. This program cannot access your online accounts and retrieve your investment information. All data has to be entered manually.

Menu

Click the menu [Portfolio] or RightClick the asset list.

Creating a New Portflio

Fill in the columns for " Symbol", " Quantity", " Account" and " Type".

  • Symbol - ticker symbol or 'INCASH' for cash savings
  • Quantity - number of shares or dollar amount of cash savings
  • Account - account name identifier for pie chart
  • Type - enter 's' for stock, 'b' for bond or 'c' for cash

When done, select "Update Portfolio" from the menu [Portfolio] and save the portfolio as an encrypted *.pfo file.

Pie Charts

You can rotate the pie-charts with the MouseWheel and by dragging. DoubleClick a pie chart to re-orient it.

Merging Portfolios

When opening saved portfolios you can press the Ctrl-key in the FileOpen dialog, in order to open several portfolios simultaneously, which will then be merged and can be saved as a combined/merged portfolio.

Lazy Portfolios

The examples for lazy portfolios are inspired by the book "The Lazy Person's Guide to Investing" by Paul B. Farrell.

These portfolios are suitable for anyone, who does not wish to spend too much effort in creating a diversified portfolio. They mostly use very low cost Vanguard funds.


Calculators

These calculators visualize the expected acquisition and distribution of financial assets without considering inflation.

The input values can be edited by using the MouseWheel (click at number and scroll) or by entering a new value. Then press <Enter> or click the button [Apply].

When considering the amount of monthly contributions one should keep in mind that in the USA you can contribute about $6,500 annually to your traditional IRA or Roth IRA and about $18,000 annually to your company 401K ($24,000 if you are over 50 years old).

Historically the stock market has performed at ~10% annually, so one can reasonably assume this value when investing over long periods (>15 years). As a diversified portfolio will include a suitable mix of stocks, bonds, money market etc. a more realistic rate of return may lie in the range of 4%-8%. One also must remember that the average inflation rate may be about 3%. Using the rule of 72 this tells us that in 24 years the buying power of a certain amount will be reduced to 50% of its original buying power.

Hint:

  • Edit values with MouseWheel and click [Apply].
  • Installments are the monthly contributions.
  • Be realistic about life expectancy. It may be higher than you think.

Select the [Calculator]-tab and use menu [Calculators] or RightClick on side panel or calculator graph.

1 - Compound Interest Calculator

This shows the power of compound interest in wealth accumulation. The result gives the end value and the total interest earned. The plot's x-axis gives the duration in years, while the input for duration is in months.

2 - Asset Allocation Calculator

Instead of assuming a single value for the return rate this calculator mirrors a portfolio (stocks, bonds, cash) with differing return rates.

3 - (Allowed) Retirement Income Calculator

This calculator visualizes the accumulation and distribution phases. The results give the total amount of savings at retirement, the possible amount of monthly income and the total value achieved until the money is exhausted (future value).

The rate of investment returns after retirement is usually lower as one gradually decreases one's exposure to stocks in the portfolio.

4 - (Needed) Retirement Savings Calculator

Enter the desired monthly income amount. Additional income from social security benefits will reduce the amount that needs to be generated by your investments. One may want to increase the income annually by about 3%, in order to keep up with the erosion of its value due to inflation. The results give the total amount of savings at retirement, the needed savings amount and the remaining estate value if any.

Export Plot Image

Use menu [File][Copy Image], in order to copy the plot image to the clipboard.


Bar-Graphs

These bar graphs help visualize retirement calculations when taking advantage of compound interest, especially when investing over long periods. The input values at the top of the plot can be edited by using the MouseWheel (click at number and scroll) or by entering a new value and hit <Enter>.

When considering the amount of monthly contributions one should keep in mind that in the USA you can contribute about $6,500 annually to your traditional IRA or Roth IRA and about $18,000 annually to your company 401K ($24,000 if you are over 50 years old).

Historically the stock market has performed at ~10% annually, so one can reasonably assume this value when investing over long periods (>15 years). As a diversified portfolio will include a suitable mix of stocks, bonds, money market etc. a more realistic rate of return may lie in the range of 4%-8%. One also must remember that the average inflation rate may be about 3%. The rule of 72 tells us that in 24 years the buying power of a certain amount will be reduced to 50% of its original buying power, which is why your investments must return >3%, otherwise you may go broke, which may happen when only investing in Bank CDs or cash savings.

A rule of thumb for the amount of savings needed at retirement is: decide on a monthly income, double it and add a zero (i.e.: income * 20). This rule derives from the fact that one may assume to generate ~5 % in annual returns on one's investments (premium may decrease; ie. you may not leave much of an inheritance to your kids).

Hint: Edit values with MouseWheel

1 - Start Early and Save Regularly

Enter your monthly investment amount, expected interest rate/annual return and desired retirement age. The plot shows how much money you will have acquired (y-values) when you start saving at a given age (x-values).

The earlier you start saving the more dramatic the accumulation of savings thanks to compound interest.

2 - Set Goal for Retirement

Enter the desired amount of savings at retirement age, the expected return on your investments and retirement age. The plot shows how much money you have to save monthly (y-values), in order to reach your goal when you start saving at a given age (x-values).

The earlier you start saving the less painful the monthly burden is.

3 - Invest Wisely

Enter your current age, retirement age and monthly contribution amount. The plot shows how much money you will have saved at retirement (y-values), when placing your monthly contributions in investments with a certain assumed rate of return (x-values).

The higher the return on your investment the more money you acquire (no surprise here).

4 - How Much Money Will I Need

Enter the number of years in retirement and the rate of investment returns after retirement, which is usually lower as one gradually decreases one's exposure to stocks in the portfolio. The plot shows how much money you need to have saved at retirement (y-values), in order to generate the desired monthly income (x-values). Keep in mind that additional income, such a social security benefits will reduce the amount that you need to generate from your investments.

Decide how much income you need in retirement and see how much savings you need when you retire.

5 - How Long Will My Money Last

Enter the amount of savings at retirement age and the rate of investment returns after retirement. The plot shows how many years your money will last (y-values) for a given monthly income amount (x-values).

See how much income you can reasonably withdraw, in order for your money to last the desired length of retirement.

6 - How Much Should I Withdraw

Enter the amount of savings at retirement age and the rate of investment returns after retirement. The plot shows how much money it is safe to withdraw monthly (y-values), in order to last a given number of years in retirement (x-values).

See how much monthly income you can safely withdraw.

Export Plot Image

Use menu [File][Copy Image], in order to copy the plot image to the clipboard.